package com.czz.ucenter.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @ClassName: JwtProperties
 * @Author Czz
 * @Date 2019/12/23
 * @Time 15:03
 **/
@Component
public class JwtProperties implements InitializingBean {

    @Value("${education.jwt.user.subject}")
    private String userSubject;

    @Value("${education.jwt.teacher.subject}")
    private String teacherSubject;

    @Value("${education.jwt.admin.subject}")
    private String adminSubject;

    @Value("${education.jwt.appsecret}")
    private String appsecret;

    @Value("${education.jwt.user.expire}")
    private int userExpire;

    @Value("${education.jwt.manage.expire}")
    private int manageExpire;

    @Value("${education.jwt.admin.name}")
    private String adminName;

    @Value("${education.jwt.teacher.name}")
    private String teacherName;

    @Value("${education.jwt.user.name}")
    private String userName;

    public static String USERSUBJECT;
    public static String TEACHERSUBJECT;
    public static String ADMINSUBJECT;
    public static String APPSECRET;
    public static int USEREXPIRE;
    public static int MANAGEEXPIRE;
    public static String ADMINNAME;
    public static String TEACHERNAME;
    public static String USERNAME;

    @Override
    public void afterPropertiesSet() throws Exception {
        USERSUBJECT = userSubject;
        TEACHERSUBJECT = teacherSubject;
        ADMINSUBJECT = adminSubject;
        APPSECRET = appsecret;
        USEREXPIRE = userExpire;
        MANAGEEXPIRE = manageExpire;
        ADMINNAME = adminName;
        TEACHERNAME = teacherName;
        USERNAME = userName;
    }
}
